#include <QFile>
#include <QString>
#include <QTextStream>
#include <stdio.h>

int main(int argc, char **argv)
{
    QFile file("./jpg.list");
    if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
        return -1;
    QFile idxfile("scanjpg.idx");
    if (!idxfile.open(QIODevice::WriteOnly | QIODevice::Text))
        return -1;
    QTextStream idxout(&idxfile);

    int offset = QString("http://www.sanskrit-lexicon.uni-koeln.de/scans/MWScan/MWScanjpg/mw").length();
    //for local copy.
    //int offset=2;
    while (!file.atEnd()) {
        QString line = file.readLine().simplified();
        QString pagenumber = line.mid(offset,4);
        QString jpgname  = line.mid(offset-2,line.length());
        idxout<<pagenumber<<";"<<jpgname<<";"<<"\n";
    }
    idxfile.close();
    file.close();
}
